package ComparatorAndComparable.ComparatorMy;

import java.util.Arrays;
import java.util.Comparator;

public class Demo {
    public static void main(String[] args) {
        Integer[] nums = {3,2,5,1,7,9};
//        Arrays.sort(nums, new MyComparator());

//        Arrays.sort(nums, new Comparator<Integer>() {
//            @Override
//            public int compare(Integer o1, Integer o2) {
//                return o2 - o1;
//            }
//        });

//        Arrays.sort(nums, (o1, o2) -> o1 - o2);
        Arrays.sort(nums, (Integer o1, Integer o2) -> {
            return o2 - o1;
        });
        System.out.println(Arrays.toString(nums));
    }
}
